﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">
    <title>项目信息</title>
    <link href="/CSS/bootstrap3.3.5/css/bootstrap.css" rel="stylesheet" type="text/css" />
    <link href="/CSS/font-awesome-4.3.0/css/font-awesome.css?v=4.3.0" rel="stylesheet">
    <link href="/CSS/V3/animate.css" rel="stylesheet">
    <link href="/CSS/V3/style.css?v=2.2.0" rel="stylesheet">
    <link href="/CSS/V3/BaseClassV3.css" rel="stylesheet" />
    <script src="/Scripts/jquery-1.11.2.min.js"></script>
    <script src="/CSS/bootstrap3.3.5/js/bootstrap.js"></script>
    <script src="/Scripts/avalon.js"></script>
    <script src="/Scripts/SZHLCommon.js?jsver=5"></script>
    <script>
        var model = avalon.define({
            $id: "APP_XMGL_INFO",
            username: ComFunJS.getnowuser(),
            modelData: {},
            xmID: ComFunJS.getQueryString("ID", 0),
            plList: [],
            flList: [],
            initForm: function () {
                if (model.xmID) {
                    //编辑加载数据
                    $.getJSON('/API/FTAPI.ashx?Action=GETXMGLMODEL', { P1: model.xmID }, function (resultData) {
                        if (resultData.ErrorMsg == "") {
                            model.modelData = resultData.Result;
                            model.plList = resultData.Result1;
                            model.flList = resultData.Result2;
                        }
                    })
                }
            },
            AddPL: function (item, dom) {
                var plcontent = dom.val();
                if ($.trim(plcontent) == "") {
                    parent.ComFunJS.winwarning("请输入消息内容");
                    return;
                }
                $.post('/API/FTAPI.ashx?Action=ADDCOMENT', { "P1": plcontent, "MsgType": "XMGL", "MsgLYID": item.xmID }, function (result) {
                    var result = $.parseJSON(result);
                    if (result.ErrorMsg == "") {
                        item.plList.push(result.Result)
                        dom.val("")
                    }
                })
            },
            jptj: function (event, item, dom) {
                if (event.ctrlKey && (event.keyCode == 13 || event.keyCode == 10)) {
                    model.AddPL(item, dom);
                }
            }
        });
        avalon.ready(function () {
            ComFunJS.initsetajax();

            model.initForm();

            if ($(".qyh_Upload:hidden").length > 0) {

                $(".qyh_Upload:hidden").each(function () {
                    var $input = $(this);
                    var btnName = $(this).attr('title') ? $(this).attr('title') : "上传文档";//按钮名称
                    var FileType = $(this).attr('FileType') ? $(this).attr('FileType') : "";//文件类型(pic代表图片)
                    var $panelsc = $('<input type="button" value="' + btnName + '" class="btn btn-xs btn-primary btn-upload" />').insertAfter($input);;
                    $panelsc.bind('click', function () {
                        parent.ComFunJS.winbtnwin(ComFunJS.getfileapi() + "fileupload", "上传", "550", "400", {}, function (layero, index, btdom) {
                            var fjids = "";
                            btdom.addClass("disabled").find("i").show();
                            var frameid = $("iframe", $(layero)).attr('id');
                            var nowwin = parent.window.frames[frameid].contentWindow;
                            nowwin.location = "/View/Base/Success.html?ID=3";//应用附件
                            var int = parent.window.setInterval("getwinname()", 1500);//循环等待,直到上传成功并返回文件数据
                            parent.window.getwinname = function () {
                                try {
                                    if (nowwin.filedata) {
                                        parent.window.clearInterval(int);
                                        var fjdata = nowwin.filedata;
                                        btdom.removeClass("disabled").find("i").hide();
                                        
                                        for (var i = 0; i < fjdata.length; i++) {
                                            fjids = fjids + fjdata[i].ID + ",";
                                        }
                                        if (fjids.length > 0) {
                                            fjids = fjids.substring(0, fjids.length - 1)
                                        }
                                        if (model.modelData.Files) {
                                            model.modelData.Files = model.modelData.Files + ',' + fjids;
                                        }
                                        else {
                                            model.modelData.Files = fjids;
                                        }
                                        var xmdata = model.modelData.$model;
                                        var modelValue = JSON.stringify(xmdata);
                                        //$.ajaxSettings.async = false;
                                        $.post("/API/FTAPI.ashx?ACTION=ADDXMGL", { P1: modelValue }, function (result) {
                                            var jsonresult = $.parseJSON(result)
                                            btdom.removeClass("disabled").find("i").hide();
                                            if ($.trim(jsonresult.ErrorMsg) == "") {
                                                model.flList.pushArray(fjdata);
                                                parent.ComFunJS.winwarning("上传成功");
                                            }
                                            parent.layer.close(index);
                                        });

                                    }
                                }catch (e) {
                                }
                            }
                        });
                    })
                })
            }
        })
        function xmzt(str) {
            if (str == "0") {
                return '<label class="label label-danger" style="margin-right:10px">正在进行</label>';
            }
            else if (str == "1") {
                return '<label class="label label-success" style="margin-right:10px">已结束</label>';
            }
        }
        function yxj(str) {
            if (str == "高") {
                return '<span><i class="fa fa-circle text-danger"></i> 高优先级</span>';
            }
            else if (str == "中") {
                return '<span><i class="fa fa-circle text-warning"></i> 中优先级</span>';
            }
            else if (str == "低") {
                return '<span><i class="fa fa-circle text-info"></i> 低优先级</span>';
            }
        }
    </script>
</head>
<body class="gray-bg" ms-controller="APP_XMGL_INFO">
    <div class="row">
        <div class="col-sm-9">
            <div class="wrapper wrapper-content animated fadeInUp">
                <div class="ibox">
                    <div class="ibox-content">
                        <div class="row">
                            <div class="col-sm-12">
                                <div class="m-b-md">
                                    <!--<a href="project_detail.html#" class="btn btn-white btn-xs pull-right">编辑项目</a>-->
                                    <h2 style="text-align:center">{{modelData.XMMC}}</h2>
                                </div>
                                <dl class="dl-horizontal">
                                    <dt>状态：</dt>
                                    <dd>
                                        {{xmzt(modelData.Status)|html}}
                                    </dd>
                                </dl>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-sm-6">
                                <dl class="dl-horizontal">
                                    <dt>项目经理：</dt>
                                    <dd><span class="text text-warning">{{ComFunJS.convertuser(modelData.XMFZR)}}</span></dd>
                                    <dt>消息：</dt>
                                    <dd>{{plList.length}}</dd>
                                    <dt>开始时间：</dt>
                                    <dd>
                                        {{modelData.StartDate|date("yyyy年MM月dd日")}}
                                    </dd>
                                    <dt>优先级：</dt>
                                    <dd>{{yxj(modelData.YXJ)|html}}
                                    </dd>
                                </dl>
                            </div>
                            <div class="col-sm-6" id="cluster_info">
                                <dl class="dl-horizontal">
                                    <dt>最后更新：</dt>
                                    <dd ><span ms-if="modelData.UpdateDate">{{modelData.UpdateDate|date("yyyy年MM月dd日 HH:mm")}} </span></dd>
                                    <dt>创建于：</dt>
                                    <dd>{{modelData.CRDate|date("yyyy年MM月dd日 HH:mm")}}</dd>
                                    <dt>结束时间：</dt>
                                    <dd>
                                        {{modelData.EndDate|date("yyyy年MM月dd日")}}
                                    </dd>
                                </dl>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-sm-12">
                                <dl class="dl-horizontal">
                                    <dt>团队成员</dt>
                                    <dd style="margin-bottom: 10px;"><span class="text-success"><span style="margin-right:10px" ms-repeat-user="modelData.XMCYR.split(',')">{{ComFunJS.convertuser(user) }}</span></span></dd>
                                    <dt>当前进度</dt>
                                    <dd>
                                        <div class="progress progress-striped active m-b-sm">
                                            <div ms-css-width="{{modelData.XMJD}}%" class="progress-bar"></div>
                                        </div>
                                        <small>当前已完成项目总进度的 <strong>{{modelData.XMJD}}%</strong></small>
                                    </dd>
                                </dl>
                            </div>
                        </div>
                        <div class="row m-t-sm">
                            <div class="col-sm-12">
                                <div class="panel blank-panel">
                                    <div class="panel-heading">
                                        <div class="panel-options">
                                            <ul class="nav nav-tabs">
                                                <li>
                                                    <a>团队消息</a>
                                                </li>
                                            </ul>
                                        </div>
                                    </div>

                                    <div class="panel-body">
                                        <div class="social-footer" style=" background: white;border:0;padding:0">

                                            <div class="social-comment" ms-repeat-item="model.plList">
                                                <span class="pull-left">
                                                    <img alt="image" ms-attr-src="'/Upload/TX/'+item.CRUser+'.jpg'" onerror="javascript: this.src = '/images/TX/default.png'">
                                                </span>
                                                <div class="media-body">
                                                    <span style="color: #3085DB;">
                                                        {{item.CRUserName}}
                                                    </span> {{item.MSGContent}}
                                                    <br /> -
                                                    <small class="text-muted">{{item.CRDate|date("MM月dd日 HH:mm")}}</small>
                                                </div>
                                            </div>

                                            <div class="social-comment">
                                                <span class="pull-left">
                                                    <img alt="image" ms-attr-src="'/Upload/TX/'+username+'.jpg'" onerror="javascript: this.src = '/images/TX/default.png'">
                                                </span>
                                                <div class="media-body">
                                                    <div class="input-group">
                                                        <input type="text" class="form-control" ms-keypress="jptj(event,model,$(this))" placeholder="填写消息(按Ctrl+Enter直接提交)" />
                                                        <span class="input-group-btn">
                                                            <button type="button" class="btn btn btn-primary addTL" autocomplete="off" ms-on-click="AddPL(model,$(this).parent().parent().find('input'))">  添加消息</button>
                                                        </span>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>

                                </div>
                                
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="col-sm-3">
            <div class="wrapper wrapper-content project-manager">
                <h4>项目描述</h4>
                <!--<img src="img/wenku_logo.png" class="img-responsive">-->
                <p class="small">
                    {{modelData.XMMS}}
                </p>
                
                <!--<h5>项目标签</h5>
                <ul class="tag-list" style="padding: 0">
                    <li>
                        <a href="project_detail.html"><i class="fa fa-tag"></i> 文档</a>
                    </li>
                    <li>
                        <a href="project_detail.html"><i class="fa fa-tag"></i> 分享</a>
                    </li>
                    <li>
                        <a href="project_detail.html"><i class="fa fa-tag"></i> 下载</a>
                    </li>
                </ul>-->
                <h5>项目文档</h5>
                <ul class="list-unstyled project-files">
                    <li ms-repeat-files="model.flList">
                        <a target="_blank" style="color: #3085DB; overflow: hidden; word-wrap: break-word; " download="filename" ms-attr-href="'/View/Common/DownLoadFile.aspx?MD5='+files.FileMD5">{{files.Name+'.'+files.FileExtendName}}</a>
                    </li>
                </ul>
                <div class="m-t-md">
                    <input class="qyh_Upload" type="text" style="display:none" />
                </div>
            </div>
        </div>
    </div>
</body>
</html>
